package com.dude.utils;

import android.content.Context;
import android.speech.tts.TextToSpeech;

public class TTS
{
	private static TextToSpeech instance = null;
	
	public static TextToSpeech getInstance(Context context, TextToSpeech.OnInitListener listener)
	{
		if (instance == null)
			instance = new TextToSpeech(context, listener);
		
		return instance; 
	}
	
	
	public static void dispose()
	{
		if (instance != null)
		{
			instance.stop();
			instance.shutdown();
			instance = null;
		}
	}
	
	public static void speak(String text){
		instance.speak(text, TextToSpeech.QUEUE_FLUSH, null);
	}
}
